﻿@model IEnumerable<vnMcdonald.Models.Cart>

@{
    ViewBag.Title = "Index";
}

    <div class="payment">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">Thanh toán</h3>
        </div>
        <div class="modal-body">
            @if(Model != null && Model.Count() > 0){
            <div class="payment-box">
                <h3>Thông tin giao hàng</h3>
                <div class="row-fluid">
                    <div class="block span6">
                        <label for="Recipient">Họ tên khách hàng:</label><input class="input-large" type="text" name="Recipient" id="Recipient" />
                    </div>
                    <div class="block span6">
                        <label for="Phone">Số điện thoại:</label><input class="input-large" type="text" name="Phone" id="Phone" />
                    </div>
                    <div class="block">
                        <label for="Address">Địa chỉ:</label><input class="input-xxlarge" type="text" name="Address" id="Address" />
                    </div>
                </div>
            </div>
            <div class="payment-box info-account">
                <h3>Thông tin thanh toán</h3>
                <div class="row-fluid">
                    <div class="block">
                        <label for="NumberAccount">Mã số tài khoản:</label><input class="input-xlarge" type="text" name="NumberAccount" id="NumberAccount" />
                    </div>
                    <div class="block">
                        <label for="NumberAccount">Tên chủ tài khoản:</label><input class="input-xlarge" type="text" name="UserAccount" id="UserAccount" />
                    </div>
                    <div class="block">
                        <label for="NumberAccount">Mã bảo mật:</label><input class="input-xlarge" type="text" name="CodePin" id="CodePin" />
                    </div>
                </div>
            </div>
            <div class="payment-box info-order">    
                <h3>Thông tin bữa ăn</h3>
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th style="width: 45%">
                            @Html.DisplayNameFor(model => model.Name)
                        </th>
                        <th style="width: 15%">
                            @Html.DisplayNameFor(model => model.Quantity)
                        </th>
                        <th style="width: 20%">
                            @Html.DisplayNameFor(model => model.Price)
                        </th>
                        <th style="width: 20%">
                            Thành tiền
                        </th>
                    </tr>
                    </thead>
                    <tbody>
                
                    @foreach (var item in Model) {
                        <tr>
        
                            <td>
                                @Html.DisplayFor(modelItem => item.Name)
                            </td>
                            <td class="text-center">
                                @Html.DisplayFor(modelItem => item.Quantity)
                            </td>
                            <td class="text-center">
                                @Html.DisplayFor(modelItem => item.Price) VNĐ
                            </td>
                            <td class="text-center">
                                @String.Format("{0:0,0}", item.Quantity*item.Price) VNĐ
                            </td>
                        </tr>
                    }
                        <tr>
                            <td colspan="5" class="price">
                                Tổng tiền: <span>@string.Format("{0:0,0}", ViewBag.TotalCart) VNĐ</span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            }else{
                <p>Chưa có món ăn trong bữa ăn của bạn</p>
            }
        </div>
        <div class="modal-footer">
            @if(Model != null && Model.Count() > 0){
                <button type="button" class="btn pull-right" data-dismiss="modal" aria-hidden="true">Hủy</button>
                @Ajax.ActionLink("Xác nhận thanh toán", "Confirm", "Payment", null, new AjaxOptions{
                    HttpMethod = "Post",
                    OnSuccess = "paymentSuccess"
                }, new { @class="btn btn-success pull-right"})                                                             
            }else{
                <a class="btn pull-right" href="#product" onclick="return hideCart()">Tiếp tục đặt món</a>
            }
        </div>
    </div>
    